<?php

namespace App\Http\Validate\Order;

use App\Http\Validate\BaseValidate;

/**
 * 销售其他费用验证器
 */
class Saleorderfee extends BaseValidate
{
    //验证规则
    protected $rule = [];
    //自定义验证信息
    protected $message = [];

    public function __construct($doaction = 'add')
    {
        if ($doaction == 'add') {
            $this->rule = [
                'fee_type_id'=>'required|integer|gt:0',
                'fee_date'=>'required',
                'fee_id'=>'required',
                'company_name'=>'required',
                'company_id'=>'required',
                'price' => 'required|gt:0',
            ];
            $this->message = [
                'fee_type_id.required' => '费用类型未选择',
                'fee_type_id.integer' => '费用类型参数错误',
                'fee_type_id.gt' => '费用类型参数错误',
                'fee_date.required' => '费用日期不能为空',
                'fee_id.required' => '费用名称不能为空',
                'company_name.required' => '单位名称不能为空',
                'company_id.required' => '单位名称必须选择',
                'price.required' => '价格不能为空',
                'price.gt' => '价格不可小于0',
            ];
        }
    }
}
